package com.example.controller;

import com.example.result.CommonResult;
import com.example.service.MessagesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: tobed
 * @date: 2022/11/18
 * @time: 14:09
 */
@RestController
@RequestMapping("messages")
public class MessagesController {

    @Autowired
    MessagesService service;

    /*查询个人消息*/
    @PostMapping("listMessage/{userId}/{type}")
    public CommonResult listMessage(@PathVariable Integer userId,@PathVariable Integer type){
        CommonResult commonResult = service.listMessage(userId,type);
        return commonResult;
    }

    /*清理个人消息*/
    @PostMapping("cleanNoRead/{userId}/{type}")
    public CommonResult cleanNoRead(@PathVariable Integer userId,@PathVariable Integer type){
        CommonResult commonResult = service.cleanNoRead(userId,type);
        return commonResult;
    }

    /*修改状态*/
    @PostMapping("changeStatus/{id}")
    public CommonResult changeStatus(@PathVariable Integer id){
        CommonResult commonResult = service.changeStatus(id);
        return commonResult;
    }

}
